import os
import os.path


if __name__ == '__main__':

    name = "D:\spider\chapter3\directory_name.py"
    print(os.path.dirname(name))
    print(os.path.basename(name))

    name = "D:\spider\chapter1"
    print(os.path.dirname(name))
    print(os.path.basename(name))
    #
    # name = r"D:\spider\aest"
    # print(name)
